import pyautogui
import pyperclip

from package.Utils.log import logger,mylog  # 导入 logger 对象(python代码)
# from User_Import import *  # 导入 myWin, screen, logger 对象(python代码)

class MyScreen:
    def __init__(self):
        self.width = 0
        self.height = 0
        self.Mouse_Position_x = 0
        self.Mouse_Position_y = 0

    #获取屏幕分辨率
    def get_Screen_ResolutionRatio(self):
        self.width,self.height = pyautogui.size()
        if mylog.log_enabled is True:
            logger.info(f'当前屏幕分辨率为：{screen.width} x {screen.height}')

    #获取鼠标坐标
    def get_Mouse_Position(self):
        self.Mouse_Position_x,self.Mouse_Position_y = pyautogui.position()
        if mylog.log_enabled is True:
            logger.info(f'当前鼠标位置为：{self.Mouse_Position_x,self.Mouse_Position_y}')

    #控制鼠标点击
    def Control_Mouse_Click(self,x,y):
        pyautogui.click(x,y)

    #复制
    def Copy(self,words):
        pyperclip.copy(words)

    #粘贴
    def Paste(self):
        pyautogui.hotkey('ctrl', 'v')

    #控制键盘输入
    def Control_Keyboard_Input(self,words):
        pyautogui.typewrite(words)

screen = MyScreen()  # 实例化 MyScreen 类